//
//  BandCell.m
//  NewPro
//
//  Created by RYX on 2018/10/12.
//  Copyright © 2018年 何荧红. All rights reserved.
//

#import "BandCell.h"
#import "BandCardModel.h"
#import "SetDefaultBankCardList.h"

@interface BandCell()

//@property (nonatomic,copy) NSArray *colorArr;
@end

@implementation BandCell

//- (NSArray *)colorArr{
//
//    if (!_colorArr) {
//
//        _colorArr = @[[UIColor colorWithHexString:@"BA595B"],[UIColor colorWithHexString:@"5C9257"],[UIColor colorWithHexString:@"C58A55"],[UIColor colorWithHexString:@"457AB8"],[UIColor colorWithHexString:@"686768"],[UIColor colorWithHexString:@"50E3C2"],[UIColor colorWithHexString:@"0F2E68"]];
//    }
//
//    return _colorArr;
//}

+ (instancetype)tempWithTableView:(UITableView *)tableView{
    
    NSString *identity = @"CELL";
    NSInteger index = 0;
    
    ClassName
    BandCell *cell =[tableView dequeueReusableCellWithIdentifier:identity];
    if (!cell) {
        
        cell = [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] objectAtIndex:index];
    }
    
    return cell;
}


+ (CGFloat)getHeight{
    
    ClassName
    UITableViewCell *cell = [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] objectAtIndex:0];
    
    return cell.frame.size.height;
    
}

- (void)setModel:(BandCardModel *)model{
    
//    UIColor *color;
//
//    if (self.colorArr.count > self.indexPath.section) {
//
//        color = self.colorArr[self.indexPath.section];
//    }else{
//
//        int R = (arc4random() % 256) ;
//        int G = (arc4random() % 256) ;
//        int B = (arc4random() % 256) ;
//        color = [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1];
//    }
    
    self.bottomView.backgroundColor = [UIColor colorWithHexString:@"BA595B"];

    self.bandName.text = model.bank;

    if ([model.defaultCard intValue] == 1) {
        
        [SetDefaultBankCardList sharedInstance].defaultModel = model;
        self.bandName.text = [NSString stringWithFormat:@"%@ (默认)",model.bank];
    }
    self.lastNumLa.text = [model.bankNo substringFromIndex:model.bankNo.length - 4];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
